/**
 * Choicesoft.com.cn Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.test.springboot;

import javax.jms.Destination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenxubing
 * @version $Id: ActiveMqConfig.java, v 0.1 2018-11-08 9:12 AM chenxubing Exp $$
 */

@Configuration
public class ActiveMqConfig {
    @Value("${spring.activemq.destination}")
    private String destination;

    @Value("${spring.jms.pub-sub-domain}")
    private boolean pubSub;

    @Bean
    public Destination destination(){
        if(pubSub){
            return new ActiveMQTopic(destination);
        }
        return new ActiveMQQueue(destination);
    }

}
